<?php
/*
 * 
 * implementare sectiune
 * 
 */

class xmlSection{
	private $dom;
	private $parentNode;
	private $parentPath;
	private $subRoot; 
	
	/**
	 * constructor
	 * @access public
	 * @param DOMElement $parent parintele sectiuni
	 * @param DOMDocument $dom handlerul documentului
	 * @param string $id id-ul noii sectiuni
	 * @param string $title continutul elem title
	 * @return bool TRUE if no error occurs
	 */
	public function __construct(& $parent, & $dom, $parentPath, $id, $title) {
		//echo '===construct==';
		$this->parentNode = & $parent;
		$this->dom = & $dom;
		$this->parentPath=$parentPath;
		
		$newSect = $this->dom->createElement('section');
		$newSectId = new DOMAttr('sectId', $id);
		$newSect->appendChild($newSectId);
		$newSectTitle=$this->dom->createElement('title',$title);
		$newSect->appendChild($newSectTitle);
		
		$this->parentNode->appendChild($newSect);
		$this->subRoot=& $newSect;
		return true;
	}
	
	public function createNewParagraph($id, $text) {
		//tretare erori!!! try
		$newParagr = new xmlBasicElements(& $this->subRoot, & $this->dom);
		$newParagr->createParagraph($id, $text);
		$this->dom->save($this->parentPath);
	}
}
?>